package com.bskj.sj.bean.vo.resp;

import com.bskj.common.bean.model.ShopCoupon;
import com.bskj.common.enums.ShopCouponValidTypeEnum;

public class ShopCouponVo extends ShopCoupon{
	private String couponRule;
	private String moneys;	
	private String vType;
	private boolean useType;
	
	public boolean getUseType() {
		return useType;
	}
	public void setUseType(boolean useType) {
		this.useType = useType;
	}
	public String getvType() {
		return vType;
	}
	public void setvType(String vType) {
		this.vType = vType;
	}
	public String getMoneys() {
		return moneys;
	}
	public void setMoneys(String moneys) {
		this.moneys = moneys;
	}
	public void setMoneys(Integer moneys) {
		this.moneys = "￥"+moneys+".0元";
	}
	public String getCouponRule() {
		return couponRule;
	}
	public void setCouponRule(String couponRule) {
		this.couponRule = couponRule;
	}
	
	private void setCouponRule(ShopCoupon shopCoupon) {
		if(shopCoupon.getValidType()==ShopCouponValidTypeEnum.coupon_crtain.getKey()){
			double time=shopCoupon.getValidTime();
			int hour=(int)time;
			couponRule="领取后"+hour+"小时"+(int)((time-hour)*60)+"分钟之内有效";
		}else {
			couponRule="领取当日"+shopCoupon.getLastTime()+"前有效";
		}
	}
	
	public ShopCouponVo getShopCouponVo(ShopCoupon item){
		ShopCouponVo shopCouponVo=new ShopCouponVo();
		shopCouponVo.setCouponMoneyType(item.getCouponMoneyType());
		shopCouponVo.setMoney(item.getMoney() / 10);
		shopCouponVo.setId(item.getId());
		shopCouponVo.setEncryptParams(item.getEncryptParams());
		shopCouponVo.setTypeDesc(item.getTypeDesc());
		shopCouponVo.setCouponRule(item);
		return shopCouponVo;
	}
	
	
}
